import java.util.*;

class IntComparator implements Comparator<Integer> {
    @Override
    public int compare(Integer o1, Integer o2) {
        o1*=o1;
        o2*=o2;
        return -o1.compareTo(o2);
    }
}

class homework41 {
    public static ArrayList<Integer> getRandArray() {
        ArrayList<Integer> allGO=new ArrayList<Integer>();
        Random ra =new Random();
        int len=ra.nextInt(20)+5;
        for(int i=0;i<len;i++)
            allGO.add(ra.nextInt(100)-50);
        return allGO;
    }

    public static ArrayList<Integer> sort(ArrayList<Integer> a1) {
        ArrayList<Integer> a2=new ArrayList<Integer>();
        Collections.addAll(a2,new Integer[a1.size()]);
        Collections.copy(a2, a1);
        Collections.sort(a2, new IntComparator());
        return a2;
    }

    public static void main(String[] args) {
        ArrayList<Integer> a1=getRandArray();
        ArrayList<Integer> a2=sort(a1);
        for(Integer i : a2)
            System.out.println(i);
    }
}